package com.pwc.soapUtil;

import java.io.IOException;

import javax.xml.soap.SOAPException;

public class SoapManager {

	private String url;

	private String userName;

	private String password;

	private String passwordType = "None";

	private String soapPayload;

	public String sendSoap() throws UnsupportedOperationException,
			SOAPException, IOException {
		String result = "";
		if ("None".equalsIgnoreCase(passwordType)) {
			result = sendNoneType();
		} else {
			result = sendPasswordText();
		}

		return result;
	}

	private String sendPasswordText() throws UnsupportedOperationException,
			SOAPException, IOException {
		SoapUtil util = new SoapUtil();
		String result = util.SendPasswordTextSoap(soapPayload, url, userName,
				password);
		return result;
	}

	private String sendNoneType() throws UnsupportedOperationException,
			SOAPException, IOException {
		SoapUtil util = new SoapUtil();
		String result = util.sendNormalSoap(soapPayload, url);
		return result;
	}

	public SoapManager() {
		super();
	}

	public SoapManager(String url, String userName, String password,
			String passwordType, String soapPayload) {
		super();
		this.url = url;
		this.userName = userName;
		this.password = password;
		this.passwordType = passwordType;
		this.soapPayload = soapPayload;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPasswordType() {
		return passwordType;
	}

	public void setPasswordType(String passwordType) {
		this.passwordType = passwordType;
	}

	public String getSoapPayload() {
		return soapPayload;
	}

	public void setSoapPayload(String soapPayload) {
		this.soapPayload = soapPayload;
	}

}
